import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': resolve(__dirname, './src')
    }
  },
  server: {
    port: 8865,
    open: true,
    proxy: {
      // 本地开发时代理跨域
      '/biz': {
        target: 'http://192.168.2.201:31999/',
        changeOrigin: true
      }
    }
  },
  envDir: './envs',
  build: {
    terserOptions: {
      compress: {
        // 生产环境移除console
        drop_console: true,
        drop_debugger: true
      }
    }
  }
})
